<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
		<title>全部订单</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<script src="js/rem.js"></script>
		<script src="js/jquery.min.js" type="text/javascript"></script>
		<link rel="stylesheet" type="text/css" href="css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/page.css" />
		<link rel="stylesheet" type="text/css" href="css/all.css" />
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/loaders.min.css" />
		<link rel="stylesheet" type="text/css" href="css/loading.css" />


	</head>
	<!--loading页结束-->
	<body>
		<header class="mui-bar mui-bar-nav report-header box-s" id="header">
			<a href="index.html"><i class="iconfont icon-fanhui fl"></i></a>
			<p id="typeName">全部订单</p>
		</header>
		<div id="main" class="mui-clearfix">
			<div class="order-top clearfloat">
				<ul>
					<li class="clearfloat cur" onclick="getList('0')"><a href="#">全部</a></li>
					<li class="clearfloat" onclick="getList('1')"><a href="#">待付款</a></li>
					<li class="clearfloat" onclick="getList('2')"><a href="#">待发货</a></li>
					<li class="clearfloat" onclick="getList('3')"><a href="#">待收货</a></li>
					<li class="clearfloat" onclick="getList('4')"><a href="#">待评价</a></li>
				</ul>
			</div>

			<div class="order-list clearfloat" id='orderList'>

			</div>

	</body>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	<script src="js/fastclick.js"></script>
	<script src="js/mui.min.js"></script>
	<script type="text/javascript" src="js/hmt.js"></script>
	<script src="./js/vue.js"></script>
	<script type="text/javascript">
		$(function() {
			//初始化数据
			getList(0);
		})

		function getList(type) {
			const MAPTYPE = {
				0: '全部订单',
				1: '待付款',
				2: '待发货',
				3: '待收货',
				4: '待评价'
			}
			// 更改顶部类型名称
			$('#typeName').text(MAPTYPE[type])
			// 更改tab选中状态
			$('.order-top li').removeClass('cur')
			$(event.currentTarget).addClass('cur')
			let url = baseUrl+'/zuul-order/orders/listWithStatus'
			$.post(url, {
				uid: localStorage.getItem('uid'),
				status: type
			}, function(result) {
				// 处理响应数据
				if (result.state == 1000) { // 正常响应
					var html = "";
					for (i in result.data) {
						var item1 = result.data[i]
						html += '<p class="ordernum box-s">订单  ' + item1.id + '<span>'+MAPTYPE[item1.status]+'</span></p>'
						for (j in item1.orderItems) {
							var item2 = item1.orderItems[j]
							html += '<div class="list clearfloat fl box-s"><a href="detail.html?id=' + item2.pid +
								'"><div class="tu fl clearfloat"><img src="' + item2.image +
								'"/></div><div class="middle clearfloat fl"><p class="tit">' + item2.title +
								'</p><p class="fu-tit">月销2000 领券减10元 店长推荐 3月压榨</p><p class="price clearfloat"><span class="xprice fl">¥' + item2.price +
								'</span><span class="yprice fl">¥308</span><span class="shu">×' + item2.num +
								'</span></p></div></a></div>';
						}
					}

					// html += '<a href="#" class="gopay-btn fr">立即支付</a>'
					$("#orderList").html(html);

				} else { // 异常响应
					alert(result.msg);
				}
			});
		}
	</script>
</html>
